package org.nvframe.camera.plugin;

import org.nvframe.camera.Camera;
import org.nvframe.entity.Entity;
import org.nvframe.event.EventService;
import org.nvframe.event.eventtype.DamageEvent;
import org.nvframe.event.eventtype.DamageListener;
import org.nvframe.manager.ConfigManager;

public class ShakyCamEffect implements CameraPlugin, DamageListener {
	
	private Camera camera;
	private Entity focusEntity;
	
	public ShakyCamEffect(Entity focusEntity) {
		this.focusEntity = focusEntity;
	}
	
	public void setCamera(Camera camera) {
		this.camera = camera;
		
		EventService.getInstance().addEventListener(this);
	}

	@Override
	public void damageReceived(DamageEvent event) {
		if(event.getTarget() != focusEntity) 
			return;
		
		if(event.getType() == DamageEvent.DAMAGE_TYPE.EXPLOSION)
			System.out.println("shaky");
		
		/*if(ConfigManager.getInstance().getActive("debugMode"))
			System.out.println("SHAKY CAM");*/
		//camera.setX(camera.getX() + 500);
	}

}
